import request from '@/config/axios'

/** 教练信息信息 */
export interface Coach {
          id: number; // ID
          userId?: number; // 用户ID
          nickname?: string; // 昵称
          avatar: string; // 头像
          personalProfile: string; // 个人简介
          name?: string; // 姓名
          mobile?: string; // 手机号
          gender: number; // 性别 1男 2女（字典：system_user_sex）
          servicePId?: number; // 授权科目（服务一级分类ID）
          serviceId?: number; // 授权科目（服务二级分类ID）
          workTime?: string; // 从业时间（字典：business_coach_work_time）
          auditStatus?: number; // 审核状态（字典：business_audit_status）
          isWork?: boolean; // 工作状态（0休息中 1上班中）
          totalScore?: number; // 总评分
          perCapitaPrice?: number; // 人均价格（单位分）
  }

// 教练信息 API
export const CoachApi = {
  // 查询教练信息分页
  getCoachPage: async (params: any) => {
    return await request.get({ url: `/business/coach/page`, params })
  },

  // 查询教练信息详情
  getCoach: async (id: number) => {
    return await request.get({ url: `/business/coach/get?id=` + id })
  },

  // 查询教练信息详情
  getCoachAll: async () => {
    return await request.get({ url: `/business/coach/all` })
  },

  getCoachServiceClassByCoachId: async (id: number) => {
    return await request.get({ url: `/business/coach/get/service/class/` + id })
  },

  // 新增教练信息
  createCoach: async (data: Coach) => {
    return await request.post({ url: `/business/coach/create`, data })
  },

  // 修改教练信息
  updateCoach: async (data: Coach) => {
    return await request.put({ url: `/business/coach/update`, data })
  },

  // 修改教练信息
  updateCoachAmount: async (data: Coach) => {
    return await request.put({ url: `/business/coach/update/amount`, data })
  },

  // 审核教练信息
  auditCoach: async (data: Coach) => {
    return await request.put({ url: `/business/coach/audit`, data })
  },

  // 删除教练信息
  deleteCoach: async (id: number) => {
    return await request.delete({ url: `/business/coach/delete?id=` + id })
  },

  /** 批量删除教练信息 */
  deleteCoachList: async (ids: number[]) => {
    return await request.delete({ url: `/business/coach/delete-list?ids=${ids.join(',')}` })
  },

  // 导出教练信息 Excel
  exportCoach: async (params) => {
    return await request.download({ url: `/business/coach/export-excel`, params })
  },
}
